﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Transport
{
    public partial class QLDonHang : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ChiTietDatXeControl chitiet = new ChiTietDatXeControl();
            try
            {
                List<chi_tiet_dat_xe> list = chitiet.getListToCancel(Session["user_name"].ToString());
                GridView_CTDX.DataSource = list;
                GridView_CTDX.DataBind();
            }
            catch(Exception)
            {
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            ChiTietDatXeControl ctrl = new ChiTietDatXeControl();

            foreach (GridViewRow row in GridView_CTDX.Rows)
            {
                CheckBox cb = (CheckBox)row.FindControl("cb_Select");
                if (cb != null && cb.Checked)
                {
                    string id = GridView_CTDX.Rows[row.RowIndex].Cells[1].Text;
                    ctrl.updateReservationStatus(id,"3");
                }
            }
        }
    }
}